using System;
using System.Collections.Generic;
using System.Text;

using GURUCORE.Portal.AspNet.Control;

namespace GURUCORE.Portal.Core.BasePagelet
{
    /// <summary>
    /// base class for all listing-data pagelet (Eg: GridPagelet, DataListPagelet, RepeaterPagelet
    /// </summary>
    public abstract class ListingPagelet : Pagelet
    {
        protected string m_sKey;
        public string Key
        {
            get { return m_sKey; }
            set { m_sKey = value; }
        }


        public virtual int ItemPerPage
        {
            get { return m_nItemPerPage; }
            set { m_nItemPerPage = value; }
        }


        /// <summary>
        /// if this listingPagelet have config UsePageLevel_CurrentPage != 0, ListingPagelet will use this field as CurrentPage
        /// </summary>
        [PageletInParam(ComboPagingManager.URLPARAM_PAGELEVEL_CURRENTPAGENUMBER, PageletInParamAttribute.URL_PARAM_SOURCE)]
        [PageletOutParam(ComboPagingManager.URLPARAM_PAGELEVEL_CURRENTPAGENUMBER, PageletOutParamAttribute.URL_PARAM_DEST)]
        protected int m_nCurrentPage;

        [PageletInParam("ThumbnailSize", PageletInParamAttribute.PAGE_CONFIGURATION_PARAM_SOURCE)]
        protected string m_sThumbnailSize;

        /// <summary>
        /// if != 0, ListingPagelet will use current pagenumber from URL
        /// </summary>
        [PageletInParam("UsePageLevel_CurrentPage", PageletInParamAttribute.PAGE_CONFIGURATION_PARAM_SOURCE)]
        protected int m_nUsePageLevel_CurrentPage;
        public int UsePageLevel_CurrentPage
        {
            get { return m_nUsePageLevel_CurrentPage; }
            set { m_nUsePageLevel_CurrentPage = value; }
        }


        protected ComboPagingManager m_pgmPager;



        /// <summary>
        /// Override this function to get  the count of Page for this pagelet
        /// </summary>
        /// <param name="p_nItemPerPage"></param>
        /// <returns></returns>
        protected abstract int GetMainListingPageCount(int p_nItemPerPage);


    }
}
